package cn.shyouchi.wuguanjia.android.ui.completeinfo;

import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/10/19 at 13:04
 * Email: 472279981@qq.com
 * Des:
 */

public class UserInfoAdapter extends BaseQuickAdapter<UserInfoModel,BaseViewHolder> {
    DetailInfoContract.View mView;
    public UserInfoAdapter(List<UserInfoModel> data, DetailInfoContract.View mView) {
        super(R.layout.item_person_info_model, data);
        this.mView = mView;
    }

    @Override
    protected void convert(BaseViewHolder holder, final UserInfoModel model) {
        holder.setImageResource(R.id.person_info_flag, model.getIcon())
                .setText(R.id.person_info_name, model.getName())
                .setText(R.id.person_info_value, TextUtils.isEmpty(model.getValue()) ? "未填写" : model.getValue());
        holder.setTextColor(R.id.person_info_value, model.getTxtColor());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.infoItemClick(model);
            }
        });

    }


}
